import React from 'react'
import { Button, message } from 'antd'
import usePubTableData from './common/pubTbaleData'
import NewsPublish from './common/pubTableConfig'
import http from '../../api'

export default function Sunset() {
    const { pubTableData, getTableList } = usePubTableData(3)
    // 删除
    const handelDelete = (id) => {
        http.delete(`/news/${id}`).then(res => {
            getTableList()
            message.success('删除成功')
        })
    }

    return (
        <div>
            <NewsPublish dataSource={pubTableData} button={(id) => <Button onClick={() => handelDelete(id)}>删除</Button>} />
        </div>
    )
} 